<?php
class ControllerModuleSattr extends Controller {
	private $error = array(); 

	public function install() {
		$this->load->model('module/sattr');
		$this->model_module_sattr->createTable();
	
		$this->load->model('setting/setting');
		$this->model_setting_setting->editSetting('sattr', array('sattr_status'=>1));
	}

	public function uninstall() {
		$this->load->model('module/sattr');
		$this->model_module_sattr->removeTable();
		 
		$this->load->model('setting/setting');
		$this->model_setting_setting->editSetting('sattr', array('sattr_status'=>0));
	}
	
	public function index() {
		//Load my Model with functions
		$this->language->load('module/sattr');
		$this->load->model('module/sattr');
		
		if(!empty($this->request->post['sattr'])) {
			$this->model_module_sattr->updateTable($this->request->post['sattr']);
		}
		elseif(empty($this->request->post['sattr'])){
			$this->model_module_sattr->cleanTable();
		}
		
		//Load the fucking All Attributes
		$this->data["sattr"]= $this->model_module_sattr->getAttributes();
		$this->data["heading_title"]=$this->language->get('heading_title');
		$this->data["submit_url"] = $this->url->link('module/sattr','token=' . $this->session->data['token'], 'SSL');
		$this->data["cancel"] =  $this->url->link('controller/extension/module.php','token=' . $this->session->data['token'], 'SSL');
		$this->data["error_warning"] = $this->error;
		
		$this->template = 'module/sattr_list.tpl';
		$this->children = array(
			'common/header',
			'common/footer'
		);
		
		//$this->response->setOutput($this->load->view('module/sattr_list.tpl', $data));		

		$this->response->setOutput($this->render());
	}
	
}
?>